//
//  VideoViewCell.m
//  News
//
//  Created by xalo on 16/2/27.
//  Copyright © 2016年 News. All rights reserved.
//

#import "VideoViewCell.h"
#import "VideoModel.h"
#import <UIImageView+WebCache.h>

#import "UIViewController+Notice.h"
#import <Reachability.h>
@implementation VideoViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


-(void)setCountentViewWithModel:(VideoModel *)model
{
    [self.infoButton setTitle:[NSString stringWithFormat:@"  %@",model.title] forState:(UIControlStateNormal)];
    
    
    NSInteger count;
    if (model.playnumber/10000 >= 10) {
        count = model.playnumber/10000;
        self.playCountButton.text =[NSString stringWithFormat:@"%ld万播放",count];
    }else{
    
        count = model.playnumber;
        self.playCountButton.text =[NSString stringWithFormat:@"%ld播放",count];
    }
    
    
   extern BOOL isWiFiMode;
    Reachability *ablity = [Reachability reachabilityForInternetConnection];
    
    if (([ablity isReachableViaWiFi])||([ablity isReachable] && !isWiFiMode)||(![ablity isReachable])) {
        
        [self.backView sd_setImageWithURL:[NSURL URLWithString:model.kpic] placeholderImage:[UIImage imageNamed:@"placeholder.jpg"] ];
    }
    
    [self layoutIfNeeded];

}






@end
